/*Hdip Project 2013-14, Student Name:- Chris Pembroke,  Student Number:- x00115839*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

using System.Web.Mvc; // needed namespace ref

namespace Exercise1Project.Models.Validation
{
    public class ModelStateWrapper : IValidationDictionary  // a class which is a wrapper for modelstate and which implements repository Ivalidationdictionary
    {
        private ModelStateDictionary _modelState;  // private field of type modelstatedictionary

        public ModelStateWrapper(ModelStateDictionary modelState)   // constructor
        {
            _modelState = modelState;
        }

        public void AddError(string key, string errorMessage)  // implements interface method
        {
            _modelState.AddModelError(key, errorMessage);
        }

        public bool IsValid   // implements interface method
        {
            get
            {
                return _modelState.IsValid;
            }
        }

    }
}
